package com.mike.web;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;

/**
 * @Description 完成tomcat的创建及启动
 * @Date 2021/8/4 14:27
 * @Created by mike
 */
public class SpringBootApplication {

    public static void run() {
        Tomcat tomcat = new Tomcat();
//        tomcat.setPort(8080);  // 默认8080
        try {
            tomcat.addWebapp("/", "C:\\"); // c盘都有
            tomcat.start();
            tomcat.getServer().await();
        } catch (LifecycleException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
